<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        ul li:hover{
            color: red;
            list-style: none;
        }
    </style>
</head>
<body>


    <script>
        var arr = ["blue","cyan","pink","red","black","green","yellow"];
        //console.log(arr['3']);
        for(var i = 0; i < arr.length; i++){
            if(arr[i] === 'red'){
                console.log(i)
            }
        }
    </script>


    <script>
        var str = ''
        for(var i = 0; i < 5; i++){
            str = str + ('<li>列表项' + i + '</li>')
        }
        console.log(str)
        document.write('<ul>' + str + '</ul>'); 
    </script> 

    <script>
        var obj = {
            a:'10',
            b:'100',
            c:'1000'
        }
        var arr = []
        for(var key in obj){
            console.log(key)
            console.log(obj[key])

            arr[key] = obj[key]
        }
        console.log(arr)
    </script>


    <script>
        function ex(arr) {
            return eval(arr.join("+"));
        };
        console.log(ex([1,2,3,4,5,6,7,8,9,10]))
    </script>


    <script>
        var ex = [1,2,3,4,5,6,7,8,9,10]
        var sum = 0;
        for(i in ex){
            sum += ex[i];
        }
        alert(sum);
    </script>

<script>
    var ex = [1,2,3,4,5,6,7,8,9,10]
    var sum = 0;
    for(var i = 0; i < ex.length; i++){
        sum = sum + ex[i];
    }
    console.log(sum);
</script>
</body>
</html>